﻿using AppService.IService.System_dictionary;
using Domain.Entity.System_dictionary;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace WebAPI.Controllers.System_dictionary
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class Sys_Dict_dataController : ControllerBase
    {
        private readonly ISys_Dict_dataService sys_Dict_DataService;

        public Sys_Dict_dataController(ISys_Dict_dataService sys_Dict_DataService)
        {
            this.sys_Dict_DataService = sys_Dict_DataService;
        }

        /// <summary>
        /// 根据类型查询数据字典的值
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        [HttpGet]
        public List<Sys_dict_data> GetSys_Dict_Datas(string type)
        {
            return sys_Dict_DataService.GetData_status(type);
        }

        /// <summary>
        /// 根据类型表名称查询数据表 
        /// </summary>
        /// <param name="Dict_name"></param>
        /// <returns></returns>
        [HttpGet]
        public List<Sys_dict_data> Get_Dict_Types(string Dict_name)
        {
            return sys_Dict_DataService.Getsys_Dict_Types(Dict_name);
        }

        /// <summary>
        /// 根据编号查询数据
        /// </summary>
        /// <param name="Dict_code"></param>
        /// <returns></returns>
        [HttpGet]
        public string GetSys_Dict_datacode(int Dict_code)
        {
            return sys_Dict_DataService.GetSys_Dict_datacode(Dict_code);
        }
    }
}
